<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<bsl:layout-render name="/WEB-INF/jsp/common/layout.jsp">
<bsl:layout-component name="html-head">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/viewArticleContent.css" />
	<script type="text/javascript"><!--
		var contextPath = "<%=request.getContextPath()%>";
		 function approveArticleContent(contentId) {
		 	$.ajax({ 
		          type: "POST", 
		          url: contextPath + "/approveArticleContent", 
		          data:"articleContent.id="+contentId, 
		          success: function(msg){ 
			 			var obj = $.parseJSON(msg);
			 			if(obj.result == "success") {
			 				window.location.href= contextPath + "/viewArticleContent";
				 		} 
		         } 
		     }); 
		 }

		 function rejectArticleContent(contentId) {
			 $.ajax({ 
		          type: "POST", 
		          url: contextPath + "/rejectArticleContent", 
		          data:"articleContent.id="+contentId, 
		          success: function(msg){ 
			 			var obj = $.parseJSON(msg);
			 			if(obj.result == "success") {
			 				window.location.href= contextPath + "/viewArticleContent";
				 		} 
		         } 
		     }); 
		}
	</script>
</bsl:layout-component>
<bsl:layout-component name="title"/>
<bsl:layout-component name="content" >
<c:set var="contextPath" value="<%=request.getContextPath()%>"></c:set>
<div style="height:38px;border:0px;padding:0;margin:0;background:url(images/title.png) repeat-x">
<div style="float:left;font: 12px/38px Verdana,microsoft yahei,Arial;padding-left:32px;color:#505050;">
	<a href="${contextPath}/viewHome">Home</a> &gt; Modifications
</div>
	
</div>
<div class="content_details">
	<table class="content_table">
		<tr>
			<td class="td_left">
				<h3>修改列表</h3>
			</td>
			<td class="td_right" colspan="2">
				<jsp:include page="../common/pageNum.jsp">
   					<jsp:param value="viewArticleContent?" name="actionName"/>
   					<jsp:param value="${page}" name="page"/>
   		        </jsp:include>
			</td>
		</tr>
		<c:forEach var="content" varStatus="vs" items="${articleContentList}">
			<c:choose>
			 	<c:when test="${vs.count%2 == 0 }">
			 		<c:set value="background-color:#ffffff;" var="bgc"></c:set>
			 	</c:when>
			 	<c:otherwise>
			 		<c:set value="background-color:#f5f5f5;" var="bgc"></c:set>
			 	</c:otherwise>
			 </c:choose>

			<tr style="border: 1px solid #999;${bgc} ">
				<td class="td_left"><a target="_blank" href="${contextPath}/viewContentChanges?article.id=${content.article.id}&contentModify.id=${content.id}">${content.article.title}</a>
					<c:if test="${not empty content.reason}">
						<p><span class="reason">${content.reason}</span></p>
					</c:if>
				</td>	
				<td class="td_creator_name">
					<a target="_blank" href="${contextPath }/viewCustomerInfo?customer.id=${content.createByUserId}">${content.createByUser.userName}</a>
				</td>
				<td class="td_right">
					<div id="content${content.id}">
					<c:choose>
						<c:when test="${ (content.version != content.article.version ) && content.state == 1}">
							<span class="content_overtime">已过期</span>
							<button class="btn btn-danger" onclick="rejectArticleContent(${content.id})">拒绝</button>
						</c:when>
						<c:when test="${content.state == 1}">
							<button class="btn btn-danger" onclick="rejectArticleContent(${content.id})">拒绝</button>
							<button class="btn btn-info" onclick="approveArticleContent(${content.id})">通过</button>
						</c:when>
						<c:when test="${content.state == 2}">
							<span class="content_pass">已通过</span>
							
						</c:when>	
						<c:when test="${content.state == 3}">
							<span class="content_reject">已拒绝</span>
						</c:when>
					</c:choose>
					</div>
				</td>		
			</tr>
			
		</c:forEach>
		<tr>
			<td class="td_right" colspan="3">
				<jsp:include page="../common/pageNum.jsp">
   					<jsp:param value="viewArticleContent?" name="actionName"/>
   					<jsp:param value="${page}" name="page"/>
   		        </jsp:include>
			</td>
		</tr>
	</table>
</div>

</bsl:layout-component>


</bsl:layout-render>